export const myRequest = (options)=>{
	console.log('API_url:',options.url)
	return new Promise((resolve,reject)=>{
		uni.request({
			url: options.url,
			method: options.method ||'GET',
			header: {'token' : options.token},
			data : options.data || {},
			success: (res) => {
				console.log('API res:',res)
				if(res.data.msg === 'token过期'){
					console.log('API code==204，login')
					return uni.showToast({
						icon : 'none',
						duration:2000,
						title : '登陆已过期或未登录，请登录',
						success: () => {
							setTimeout(() => {
								uni.reLaunch({
									url:'/pages/login/login'
								})
							},1000)	
						}
					});
				}
				resolve(res)
			},
			fail: (err) =>{
				console.log(err)
				uni.showToast({
					title : '接口访问失败'
				})
				reject(err)
			}			
		})
	})
}